package com.linkdood.app.service.impl;

import com.linkdood.app.service.ZipService;
import com.linkdood.app.utils.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.List;

/**
 * 文件压缩服务
 */
@Slf4j
@Service
public class ZipServiceImpl implements ZipService {

    @Async
    @Override
    public void compressFiles2Zip(List<File> localFiles, File zipFile, List<String> realFilenames) {
        Boolean verification = FileUtil.compressedFileVerification(localFiles, zipFile, realFilenames);
        if(verification){
            FileUtil.compressFiles2ZipProcess(localFiles, zipFile, realFilenames);
        }
    }


}
